#include <vector>
#include <string>
#include <vector>
#include <list>
#include <deque>

using namespace std;


void iteratorEndReturn();

void SequenceComtainerTest()
{
	char *words[] = {"stately", "plump", "buck", "mulligan"};
	size_t words_size = sizeof(words) / sizeof(char *);

	list<string> wordList(words, words + words_size);

	const vector<int> iv(10);
	vector<string> sv(10);
	list<int> il(10);

	/* *
	vector<int>::iterator iit = iv.begin(); // Error C2440: 'initializing' : cannot convert from 'std::_Vector_const_iterator<_Myvec>' to 'std::_Vector_iterator<_Myvec>'
	list<int>::iterator ilt = il.begin() + 2; // Error C2784: 'std::_Deque_iterator<_Ty,_Alloc> std::operator +(_Deque_iterator<_Ty,_Alloc>::difference_type,std::_Deque_iterator<_Ty,_Alloc>)' : could not deduce template argument for 'std::_Deque_iterator<_Ty,_Alloc>' from 'int'
	vector<string>::iterator sit = &sv[0]; // Error error C2440: 'initializing' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax> *' to 'std::_Vector_iterator<_Myvec>'	d:\own projects\codeplex\cppprimer\sequencecontainer\sequencecontainer.cpp	23	1	SequenceContainer
	for(vector<string>::iterator it = sv.begin(); it != 0; ++it); // Error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_Vector_iterator<_Myvec>' (or there is no acceptable conversion)
	* */

	iteratorEndReturn();
}


void iteratorEndReturn()
{
	vector<int> iv(3, 0);
	vector<int>::iterator first = iv.begin(), last = iv.end();
	int i = 0;
	
	// while(first != last) // this will cause an exception when 2nd loop
	while(first != iv.end()) 
	{
		first = iv.insert(first, ++i);
		++first;
		if(i >= 10)
			break;
	}
}